﻿using OSCSchema;

namespace OSC.Base
{
    public class Picture : IActivityDetail, IListItem
    {
        private readonly string m_Name;
        private readonly string m_Source;
        private readonly string m_Url;
        private readonly string m_AltText;

        public Picture(string name, string source,string url, string altText)
        {
            m_Name = name;
            m_Source = source;
            m_Url = url;
            m_AltText = altText;
        }

        public templateVariableType ToTemplateVariableType()
        {
            return new templateVariableType
                       {
                           name = m_Name,
                           altText = string.IsNullOrEmpty(m_AltText) ? m_Source : m_AltText,
                           value = m_Source,
                           href= m_Url,
                           type = templateTypeRestrictionType.pictureVariable
                       };
        }

        public simpleTemplateVariableType ToSimpleTemplateVariableType()
        {
            return new simpleTemplateVariableType
                       {
                           name = m_Name,
                           altText = string.IsNullOrEmpty(m_AltText) ? m_Source : m_AltText,
                           value = m_Source,
                           href = m_Url,
                           type = templateSimpleTypeRestrictionType.pictureVariable
                       };
        }
    }
}